package com.ocom.payconfig.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.card.EntityXfChannelInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDaoChannelInfo extends BaseMapper<EntityXfChannelInfo> {

	@Select({"<script>",
			"select  *  \n" +
					"FROM xf_channel_info \n" +
					"where com_id=#{comId} " +
					"and SUBSTRING(pay_type,4,1) = '1' ",
					" <when test=\"payWay &gt; 0 \" > "+
					" AND pay_way = #{payWay} "+
					" </when> "+
			"</script>"})
	List<EntityXfChannelInfo> getSignList(@Param("comId")Long comId,Integer payWay);

	@Select({"<script>",
			"select  c.*,m.merch_name  \n" +
					"FROM xf_channel_info c \n" +
					"LEFT JOIN xf_merchant_info m ON m.com_id=c.com_id and c.merch_id=m.merch_id \n"+
					"where  c.com_id = #{comId} ",
					" <when test=\"merchId !=null and  merchId &gt; 0  \" > "+
					" AND c.merch_id = #{merchId} "+
					" </when> "+
					" <when test=\"id !=null and id &gt; 0 \" > "+
					" AND c.id = #{id} "+
					" </when> "+
					"</script>"})
	List<EntityXfChannelInfo> getChannelList(@Param("comId")Long comId,
											 @Param("merchId")Integer merchId,
											 @Param("id")Integer id);


}
